Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add easy support for single node sqlite with kine #5954

Merged
merged 1 commit into from
May 31, 2024

Conversation

vitorsavian
Copy link
Member

@vitorsavian vitorsavian commented May 23, 2024

Proposed Changes

  • A easy way to set sqlite single node (the same way k3s does)

Types of Changes

  • New Feature

Verification

you will need to disable etcd and not send the server flag

rke2 server --disable-etcd

Testing

Linked Issues

User-Facing Change

New behavior when --disable-etcd is used without --server, rke2 will use sqlite as the default database

Further Comments

@vitorsavian vitorsavian requested a review from a team as a code owner May 23, 2024 10:17
@codecov-commenter
Copy link

codecov-commenter commented May 23, 2024

Codecov Report

Attention: Patch coverage is 0% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 26.09%. Comparing base (d2cae59) to head (fc354de).
Report is 8 commits behind head on master.

Files Patch % Lines
pkg/rke2/rke2_linux.go 0.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           master    #5954       +/-   ##
===========================================
+ Coverage    9.86%   26.09%   +16.22%     
===========================================
  Files          32       32               
  Lines        2686     2698       +12     
===========================================
+ Hits          265      704      +439     
+ Misses       2399     1948      -451     
- Partials       22       46       +24     
Flag Coverage Δ
inttests 9.82% <0.00%> (-0.05%) ⬇️
unittests 18.57% <0.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@vitorsavian vitorsavian requested review from brandond and a team May 27, 2024 14:27
@@ -32,6 +32,11 @@ var (
Usage: "(components) Enable rke2 default cloud controller manager's service controller",
EnvVar: "RKE2_ENABLE_SERVICELB",
},
&cli.BoolTFlag{
Name: "cluster-init",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While the wording comes over from K3s, I don't thing that there is any reason for use to reuse a confusing name as cluster-init. Its even more confusing that you need to "set it to false" for something to happen. Something like sqlite or single-node-sqlite could be clearer about what we intend.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After more discussing, I've come around to just keeping it as is. The only people who will actually want/use this feature are likely coming from K3s anyways.

Copy link
Member Author

@vitorsavian vitorsavian May 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dereknola I think it is still a valid discussion, it isn't a very straightforward cli flag to be fair.

In my opinion after some thoughts is that we should stick with the single-node-sqlite

@@ -32,6 +32,11 @@ var (
Usage: "(components) Enable rke2 default cloud controller manager's service controller",
EnvVar: "RKE2_ENABLE_SERVICELB",
},
&cli.BoolFlag{
Name: "single-node-sqlite",
Copy link
Member

@brandond brandond May 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're not going to reuse the existing cluster-init flag then we need to be thoughtful about what we call this new flag. --single-node-sqlite isn't quite correct, as you can still have multiple nodes - it's just that you can only have a single server.

Would it break things if --disable-etcd without setting a --server address to join enabled sqlite, in the absence of etcd files on disk?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when we receive disable-etcd without --server we return this error here

FATA[0000] invalid flag use; --server is required with --disable-etcd

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we could set as single-server-sqlite

Copy link
Member

@brandond brandond May 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when we receive disable-etcd without --server we return this error here

Right, but what if we made that the combination to enable sqlite, instead of adding a new flag?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It work very well, I updated my PR with this combination.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this combination as well, nice reuse of existing flags.

Signed-off-by: Vitor Savian <[email protected]>

Disable etcd when single node with kine

Signed-off-by: Vitor Savian <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants